package types

type DateCountRes struct {
	Date  string `json:"date"`
	Count uint64 `json:"count"`
}

type VersionTrendItem struct {
	Title string   `json:"title"`
	Value []uint64 `json:"value"`
}
type VersionTrendRes struct {
	Date []string           `json:"date"`
	List []VersionTrendItem `json:"list"`
}

type EpisodeShowingsMap struct {
	EpisodeCode    string   `json:"episode_code"`
	ShowingsNumber []string `json:"showings_number"`
}

type GetWaitAssignStepCategoryCountReq struct {
	ProjectId                 uint64               `json:"project_id" binding:"required"`
	StepType                  string               `json:"step_type"`
	BaseCountStepCategoryList []uint64             `json:"base_count_step_category_list" binding:"required"`
	StepCategoryId            []uint64             `json:"step_category_id"`
	AssignStatus              []string             `json:"assign_status" binding:"required"`
	EpisodeShowingsMap        []EpisodeShowingsMap `json:"episode_showings_map"`
}

type StepCategoryWithCount struct {
	Id              uint64 `json:"id"`
	Name            string `json:"name"`
	Code            string `json:"code"`
	EntityId        int64  `json:"entity_id"`
	ParentId        int64  `json:"parent_id"`
	Index           int64  `json:"index"`
	IsStandard      string `json:"is_standard"`
	TaskType        string `json:"task_type"`
	IsDeprecate     string `json:"is_deprecate"`
	Uuid            string `json:"uuid"`
	WaitAssignCount uint64 `json:"wait_assign_count" gorm:"-"`
}

// 待办统计
type TodoTaskOverviewReq struct {
	ProjectIdList []uint64 `json:"project_id_list"`
	StartTime     int64    `json:"start_time"`
	EndTime       int64    `json:"end_time"`
	QueryCodeList []string `json:"query_code_list"` // 查询的统计内容
}

type TodoTaskOverviewResItemCountData struct {
	ProjectId uint64 `json:"project_id"` // 有些统计项 需要区分项目
	Number    int64  `json:"number"`     // 统计值
}

type TodoTaskOverviewResItem struct {
	Code      string                             `json:"code"`       // 统计的指标
	CountData []TodoTaskOverviewResItemCountData `json:"count_data"` // 统计的指标值
}

type TodoTaskOverviewResItemAsync struct {
	CountItem TodoTaskOverviewResItem
	Err       error
}

type TodoTaskOverviewRes []TodoTaskOverviewResItem

type TaskCheckShotTaskDoneReq struct {
	ProjectId int64    `json:"project_id" binding:"required"`
	EpisodeId int64    `json:"episode_id" binding:"required"`
	ScList    []string `json:"sc_list"`
	SeqList   []string `json:"seq_list"`
}

type CheckShotTaskDoneRes struct {
	ScList  []string `json:"sc_list"`
	SeqList []string `json:"seq_list"`
}

type TaskCountGroupByDepartmentTaskStatus struct {
	Count        int64
	DepartmentId int64
	StatusText   string
	Executor     int64
}

type TaskCountGroupByStepCategoryTaskStatus struct {
	Count          int64
	StepCategoryId int64
	StatusText     string
	StepId         int64
}

type DepartmentNotAssignCount struct {
	DepartmentId int64
	Count        int64
}

type StepCategoryStepNotAssignCount struct {
	StepCategoryId int64
	StepId         int64
	Count          int64
}

type DepartmentOverdueTaskCount struct {
	DepartmentId int64
	Executor     int64
	Count        int64
}

type StepCategoryOverdueTaskCount struct {
	StepCategoryStepNotAssignCount
}

type StepCategoryDeprecatedTaskCount struct {
	StepCategoryStepNotAssignCount
}

type TaskWorkOrderCountByStepCategory struct {
	StepCategoryStepNotAssignCount
	ReportType string
}

type DepartmentDeprecatedTaskCount struct {
	DepartmentOverdueTaskCount
}

type TaskWorkOrderCountByDepartmentUser struct {
	DepartmentOverdueTaskCount
	ReportType string
}

type TaskSurveyReq struct {
	ProjectId          int64                 `json:"project_id"`
	StartTime          int64                 `json:"start_time"`
	EndTime            int64                 `json:"end_time"`
	EpisodeList        []EpisodeShowingsItem `json:"episode_list"`
	DepartmentIdList   []int64               `json:"department_id_list"`
	QueryType          string                `json:"query_type" validate:"required,department|step_category"`
	StepIdList         []int64               `json:"step_id_list"`
	StepCategoryIdList []int64               `json:"step_category_id_list"`
}

type TaskSurveyRes struct {
	Id                           int64  `json:"id"`
	Name                         string `json:"name"`
	Type                         string `json:"type"`
	ParentId                     int64  `json:"parent_id"`
	NotAssignExecutorTask        int64  `json:"not_assign_executor_task"`
	NotStartTask                 int64  `json:"not_start_task"`
	InProgressTask               int64  `json:"in_progress_task"`
	WaitReviewTask               int64  `json:"wait_review_task"`
	DoneTask                     int64  `json:"done_task"`
	OverdueTask                  int64  `json:"overdue_task"`
	ArtRepairWorkOrder           int64  `json:"art_repair_work_order"`
	QualityRepairWorkOrder       int64  `json:"quality_repair_work_order"`
	TechSupportRepairWorkOrder   int64  `json:"tech_support_repair_work_order"`
	ToolQuestionRepairWorkOrder  int64  `json:"tool_question_repair_work_order"`
	OtherQuestionRepairWorkOrder int64  `json:"other_question_repair_work_order"`
	TotalRepairWorkOrder         int64  `json:"total_repair_work_order"`
	DeprecatedTask               int64  `json:"deprecated_task"`
}

type EpisodeShowingsItem struct {
	EpisodeCode        string   `json:"initial_episode_code" binding:"required"`
	ShowingsNumberList []string `json:"showings_number"`
}

type TaskSurveyDetailListReq struct {
	Id          int64                 `json:"id" binding:"required"`
	ParentId    int64                 `json:"parent_id"`
	ColumnKey   string                `json:"column_key" binding:"required"`
	Type        string                `json:"type" binding:"required"`
	Page        []int                 `json:"page" binding:"required"`
	ProjectId   int64                 `json:"project_id"`
	StartTime   int64                 `json:"start_time"`
	EndTime     int64                 `json:"end_time"`
	EpisodeList []EpisodeShowingsItem `json:"episode_list"`
}

type TaskSurveyDetailListRes struct {
	TaskId           int64  `json:"task_id"`
	TaskName         string `json:"task_name"`
	AssetGrade       string `json:"asset_grade"`
	AssetType        string `json:"asset_type"`
	StepCategoryName string `json:"step_category_name"`
	StepName         string `json:"step_name"`
	CompanyName      string `json:"company_name"`
	DepartmentName   string `json:"department_name"`
	PersonInCharge   string `json:"person_in_charge"`
	Executor         string `json:"executor"`
	ProjectName      string `json:"project_name"`
}

// 工单完成情况列表请求参数
type WorkOrderTaskCompletionListReq struct {
	ProjectIdList    []uint64 `json:"project_id_list"`
	StartTime        int64    `json:"start_time"`
	EndTime          int64    `json:"end_time"`
	StepCategoryCode []string `json:"step_category_code"`
	WorkOrderType    string   `json:"work_order_type"` // 发出工单,收到工单|step_category,relate_step
	Page             []int    `json:"page" binding:"required"`
	ReportType       string   `json:"report_type"` // 工单类型
	TaskWorkStatus   int64    `json:"task_work_status"`
}

// 周例会-任务完成详情-列表
type TaskCompletionListReq struct {
	Page             []int    `json:"page" binding:"required"`
	EndTime          int64    `json:"end_time"`
	StartTime        int64    `json:"start_time"`
	ProjectIdList    []uint64 `json:"project_id_list"`
	StepCategoryCode []string `json:"step_category_code" binding:"required"`
	StatisticType    string   `json:"statistic_type"`
}

// 工单完成情况请求参数
type WorkOrderTaskCompletionReq struct {
	ProjectIdList    []uint64 `json:"project_id_list"`
	StartTime        int64    `json:"start_time"`
	EndTime          int64    `json:"end_time"`
	StepCategoryCode []string `json:"step_category_code"`
	WorkOrderType    string   `json:"work_order_type"` // 发出工单,收到工单|step_category,relate_step
}

// 任务完成情况请求参数
type TaskCompletionReq struct {
	ProjectIdList    []uint64 `json:"project_id_list"`
	StartTime        int64    `json:"start_time"`
	EndTime          int64    `json:"end_time"`
	StepCategoryCode []string `json:"step_category_code" binding:"required"`
}

// 任务完成Item
type WeekMeetingItem struct {
	Name            string   `json:"name"`
	Value           int64    `json:"value"`
	StatisticType   string   `json:"statistic_type"`    // 统计分类
	StepCategoryIds []uint64 `json:"step_category_ids"` // 工序分类id
}

// 周例会-任务完成情况
type WeekMeetingTaskFinishItem struct {
	BeforeTotal []WeekMeetingItem `json:"before_total"` // 之前累计
	ThisWeek    []WeekMeetingItem `json:"this_week"`    // 本周
	Excess      []WeekMeetingItem `json:"excess"`       // 超额
}

// SeriesItem
type SeriesItem struct {
	Name            string   `json:"name"`
	StepCategoryIds []uint64 `json:"step_category_id"`
	Data            []uint64 `json:"data"`
}

// EntityItem
type EntityItem struct {
	Id                 uint64 `json:"id"`
	Name               string `json:"name"`
	Code               string `json:"code"`
	InitialEpisodeCode string `json:"initial_episode_code"`
}

// TaskItem
type TaskItem struct {
	Id             uint64 `json:"id"`
	StepId         int64  `json:"step_id"`
	StepCategoryId uint64 `json:"step_category_id"`
	ProjectId      uint64 `json:"project_id"`
	TenantId       uint64 `json:"tenant_id"`
	DepartmentId   uint64 `json:"department_id"`
	Assignee       uint64 `json:"assignee"`
	Executor       uint64 `json:"executor"`
	Name           string `json:"name"`
	PlanEndTime    uint64 `json:"plan_end_time"`
	EndTime        uint64 `json:"end_time"`
}

// ProjectItem
type ProjectItem struct {
	Id   uint64 `json:"id"`
	Name string `json:"name"`
	Code string `json:"code"`
	Type string `json:"type"`
}

// StepItem
type StepItem struct {
	Id   int64  `json:"id"`
	Name string `json:"name"`
	Code string `json:"code"`
}

// TenantItem
type TenantItem struct {
	Id       uint64 `json:"id"`
	Name     string `json:"name"`
	Status   string `json:"status"`
	Created  uint64 `json:"created"`
	Role     string `json:"role"`
	CreateBy string `json:"create_by"`
}

// DepartmentItem
type DepartmentItem struct {
	Id              uint64 `json:"id"`
	Name            string `json:"name"`
	TenantId        uint64 `json:"tenant_id"`
	ParentId        uint64 `json:"parent_id"`
	Created         int64  `json:"created"`
	StepCategoryIds string `json:"step_category_ids"`
}

// ExecutorItem
type ExecutorItem struct {
	Id     uint64 `json:"id"`
	Name   string `json:"name"`
	Email  string `json:"email"`
	Phone  string `json:"phone"`
	Avatar string `json:"avatar"`
}

// AssigneeItem
type AssigneeItem struct {
	Id     uint64 `json:"id"`
	Name   string `json:"name"`
	Email  string `json:"email"`
	Phone  string `json:"phone"`
	Avatar string `json:"avatar"`
}

// TaskStatusItem
type TaskStatusItem struct {
	Id   int64  `json:"id"`
	Name string `json:"name"`
	Code string `json:"code"`
	Icon string `json:"icon"`
}

// 周例会-任务完成详情-entity
type WeekWorkOrderInfo struct {
	Series []SeriesItem `json:"series_item"`
	Data   []string     `json:"data"`
}

// 周例会-任务完成详情-entity
type WeekCompletionItem struct {
	Entity     EntityItem     `json:"entity"`
	Task       TaskItem       `json:"task"`
	Project    ProjectItem    `json:"project"`
	Step       StepItem       `json:"step"`
	Tenant     TenantItem     `json:"tenant"`
	Department DepartmentItem `json:"department"`
	Executor   ExecutorItem   `json:"executor"`
	Assignee   AssigneeItem   `json:"assignee"`
	TaskStatus TaskStatusItem `json:"task_status"`
}

type ResWeekCompletionItem []WeekCompletionItem

type WorkOrderTaskWorkOrderItem struct {
	Id                   uint64 `json:"id"`
	Number               string `json:"number"`
	Name                 string `json:"name"`
	ReportType           string `json:"report_type"`
	ReportContent        string `json:"report_content"`
	RelateStepCategoryId uint64 `json:"relate_step_category_id"`
	Created              uint64 `json:"created"`
	ProcessedPeople      string `json:"processed_people"`
	Treatment            string `json:"treatment"`
	Incidence            string `json:"incidence"`
	Status               uint64 `json:"status"`
	ProjectId            uint64 `json:"project_id"`
	CreatedBy            uint64 `json:"created_by"`
	Receiver             uint64 `json:"receiver"`
	CloseAt              uint64 `json:"close_at"`
}

type WorkOrderEntityItem struct {
	Id                 uint64 `json:"id"`
	Name               string `json:"name"`
	Code               string `json:"code"`
	InitialEpisodeCode string `json:"initial_episode_code"`
	ShowingsNumber     string `json:"showings_number"`
	ModuleId           uint64 `json:"module_id"`
	Asset              string `json:"asset"`
	Grade              string `json:"grade"`
	Level              string `json:"level"`
	Media              string `json:"media"`
	Style              string `json:"style"`
	Design             uint64 `json:"design"`
	Status             uint64 `json:"status"`
	Weather            string `json:"weather"`
	Category           string `json:"category"`
	IsOutsource        string `json:"is_outsource"`
	TimeOfDate         string `json:"time_of_date"`
}

type WorkOrderTaskItem struct {
	Id             uint64 `json:"id"`
	StepId         uint64 `json:"step_id"`
	StepCategoryId uint64 `json:"step_category_id"`
}

type WorkOrderProjectItem struct {
	Id   uint64 `json:"id"`
	Name string `json:"name"`
	Code string `json:"code"`
}

type WorkOrderStepItem struct {
	Id   uint64 `json:"id"`
	Name string `json:"name"`
	Code string `json:"code"`
}

type WorkOrderStepCategoryItem struct {
	Id   uint64 `json:"id"`
	Name string `json:"name"`
	Code string `json:"code"`
}

type WorkOrderRelateStepCategoryItem struct {
	Id   uint64 `json:"id"`
	Name string `json:"name"`
	Code string `json:"code"`
}

type WorkOrderCreatedByItem struct {
	Id   uint64 `json:"id"`
	Name string `json:"name"`
}

type WorkOrderReceiverItem struct {
	Id   uint64 `json:"id"`
	Name string `json:"name"`
}

// 周例会-工单情况列表-Item
type WorkOrderSituationItem struct {
	TaskWorkOrder      WorkOrderTaskWorkOrderItem      `json:"task_work_order"`
	Entity             WorkOrderEntityItem             `json:"entity"`
	Task               WorkOrderTaskItem               `json:"task"`
	Project            WorkOrderProjectItem            `json:"project"`
	Step               WorkOrderStepItem               `json:"step"`
	StepCategory       WorkOrderStepCategoryItem       `json:"step_category"`
	RelateStepCategory WorkOrderRelateStepCategoryItem `json:"relate_step_category"`
	CreatedBy          WorkOrderCreatedByItem          `json:"created_by"`
	Receiver           WorkOrderReceiverItem           `json:"receiver"`
}

// 周例会-工单情况列表
type ResWorkOrderSituationItem []WorkOrderSituationItem

// GetWorkOrderSituationReq
type GetWorkOrderSituationReq struct {
	TenantId         int64    `json:"tenant_id"`
	StartTime        int64    `json:"start_time"`
	EndTime          int64    `json:"end_time"`
	ProjectIdList    []uint64 `json:"project_id_list"`
	StepCategoryIds  []uint64 `json:"step_category_ids"`
	WorkOrderType    string   `json:"work_order_type"`
	StepCategoryCode []string `json:"step_category_code"`
}

// GetTaskCompletionReq
type GetTaskCompletionReq struct {
	ProjectIdList    []uint64 `json:"project_id_list"`
	StartTime        int64    `json:"start_time"`
	EndTime          int64    `json:"end_time"`
	StepCategoryIds  []uint64 `json:"step_category_ids"`
	TenantId         int64    `json:"tenant_id"`
	StepCategoryCode []string `json:"step_category_code"`
	NotStatusIds     []int64
	StatisticType    string `json:"statistic_type"`
	Page             []int  `json:"page"`
}

type UserCountDetailReq struct {
	ProjectId          []int64 `json:"project_id"`
	UserId             int64   `json:"user_id"`
	StartTime          int64   `json:"start_time"`
	EndTime            int64   `json:"end_time"`
	StepCategoryIdList []int64 `json:"step_category_id_list"`
	CategoryName       string  `json:"category_name"`
}

type UserCountDetailRes struct {
	UserInfo            GetMyUserInfoResData `json:"user_info"`
	TaskTotal           int64                `json:"task_total"`
	TaskDone            int64                `json:"task_done"`
	TaskDonePercent     float64              `json:"task_done_percent"`     // 完成率
	TaskDeliveryPercent float64              `json:"task_delivery_percent"` // 交付率
	TaskRepairPercent   float64              `json:"task_repair_percent"`   // 返修率
	TaskOverdueTimes    int64                `json:"task_overdue_times"`    // 延期次数
	FullSituation       string               `json:"full_situation"`        // 产能饱和情况
}
